<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />

    <title></title>
    <!-- GOOGLE FONTS -->
    <link href="https://fonts.googleapis.com/css?family=Montserrat:400,500|Poppins:400,500,600,700|Roboto:400,500" rel="stylesheet"/>
    <link href="https://cdn.materialdesignicons.com/3.0.39/css/materialdesignicons.min.css" rel="stylesheet" />

    <!-- PLUGINS CSS STYLE -->
    <link href="assets/plugins/toaster/toastr.min.css" rel="stylesheet" />
    <link href="assets/plugins/nprogress/nprogress.css" rel="stylesheet" />
    <link href="assets/plugins/flag-icons/css/flag-icon.min.css" rel="stylesheet"/>
    <link href="assets/plugins/jvectormap/jquery-jvectormap-2.0.3.css" rel="stylesheet" />
    <link href="assets/plugins/ladda/ladda.min.css" rel="stylesheet" />
    <link href="assets/plugins/select2/css/select2.min.css" rel="stylesheet" />
    <link href="assets/plugins/daterangepicker/daterangepicker.css" rel="stylesheet" />
    <!-- SLEEK CSS -->
    <link id="sleek-css" rel="stylesheet" href="assets/css/sleek.css" />

    <!-- FAVICON -->
    <link href="assets/img/favicon.png" rel="shortcut icon" />
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script src="/assets/plugins/nprogress/nprogress.js"></script>
</head>

<body class="header-fixed header-light" id="body">
<div class = "wrapper">
    <div class = "page-wrapper">
        <div th:include = "header::header"></div>
        <div class = "content-wrapper">
            <div class = "content">
                <div class = "bg-white border-rounded">
                    <div class = "row no-gutters">
                        <div class="profile-content-left pt-5 pb-3 pl-5 pr-5 m-auto">
                            <div class="card" th:object="${good}">
                                <img class="card-img-top" th:src="*{avataruri}" alt="Card image cap" style="width: 400px;">
                                <div class="card-body" >
                                    <a href="#"><h2 class="card-title" style="word-wrap: break-word;
                                       word-break: break-all;
                                       max-width: 360px;
                                       text-align: center;
                                       " th:text = "*{name}">Card title</h2></a>

                                    <h5 style="text-align: right;color: darkorange" class = "font-weight-bold" th:text="'¥' + ${good.price}">¥ 22.4</h5>
                                    <p class="card-text ml-auto mr-auto mt-3"
                                       style="word-wrap: break-word;
                                       word-break: break-all;
                                       max-width: 360px;
                                       " th:text="*{description}">
                                        Some quick example text to build on the card title and make up the bulk of the card's content.
                                    </p>
                                    <p class="mr-0 ml-auto mt-3"
                                       style="text-align: right;word-wrap: break-word;max-width: 100px;text-overflow: ellipsis;overflow: hidden">
                                        卖家：<a th:href="@{'/profile='+${seller.username}}" th:text="${seller.name}"></a>
                                    </p>
                                    <p class="mr-0 ml-auto mt-3"
                                       style="text-align: right;word-wrap: break-word;max-width: 100px;text-overflow: ellipsis;overflow: hidden">
                                        库存：<span th:text="*{stock}">23333</span>
                                    </p>
                                    <br>
                                </div>
                                <div class="mb-3 ml-auto mr-auto">
                                    <div th:if="${user.id} != ${seller.id}">
                                        <form th:action = "@{/pay}" method="get" name = "goodsid" >
                                            <input type = "hidden" th:value="*{id}" name = "id">
                                            <button type="submit" class="btn btn-primary" style="width: 100px; text-align: center;margin: 0 auto;">购买</button>
                                        </form>
                                    </div>
                                    <div th:if="${user.id} == ${seller.id}">
                                        <div style="display: inline-block">
                                            <form th:action = "@{'/edit-goods=' + ${good.id}}" method="get" name = "goodsid" >
                                                <input type = "hidden" th:value="*{id}" name = "id">
                                                <button type="submit" class="btn btn-primary" style="width: 100px; text-align: center;margin: 0 auto;">修改信息</button>
                                            </form>
                                        </div>
                                        <div style="display: inline-block">
                                            <form th:action = "@{/delete-goods}" th:method="post">
                                                <input type = "hidden" th:value="*{id}" name = "id">
                                                <button type="submit" class="btn btn-primary" style="width: 100px; text-align: center;margin: 0 auto;">删除商品</button>
                                            </form>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDCn8TFXGg17HAUcNpkwtxxyT9Io9B_NcM" defer></script>
<script src="/assets/plugins/jquery/jquery.min.js"></script>
<script src="/assets/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="/assets/plugins/toaster/toastr.min.js"></script>
<script src="/assets/plugins/slimscrollbar/jquery.slimscroll.min.js"></script>
<script src="/assets/plugins/charts/Chart.min.js"></script>
<script src="/assets/plugins/ladda/spin.min.js"></script>
<script src="/assets/plugins/ladda/ladda.min.js"></script>
<script src="/assets/plugins/jquery-mask-input/jquery.mask.min.js"></script>
<script src="/assets/plugins/select2/js/select2.min.js"></script>
<script src="/assets/plugins/jvectormap/jquery-jvectormap-2.0.3.min.js"></script>
<script src="/assets/plugins/jvectormap/jquery-jvectormap-world-mill.js"></script>
<script src="/assets/plugins/daterangepicker/moment.min.js"></script>
<script src="/assets/plugins/daterangepicker/daterangepicker.js"></script>
<script src="/assets/plugins/jekyll-search.min.js"></script>
<script src="/assets/js/sleek.js"></script>
<script src="/assets/js/chart.js"></script>
<script src="/assets/js/date-range.js"></script>
<script src="/assets/js/map.js"></script>
<script src="/assets/js/custom.js"></script>
</body>
</html>
